package com.loukou.lkt.web.processor;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.loukou.lkt.lkt.req.PoPurchaseOrderDetailReqDto;
import com.loukou.lkt.lkt.req.PurchaseOrderReqDto;
import com.loukou.lkt.lkt.resp.PageModel;
import com.loukou.lkt.lkt.resp.PoPurchaseOrderDetailRespDto;
import com.loukou.lkt.lkt.resp.PoPurchaseOrderGoodsDto;
import com.loukou.lkt.lkt.resp.PurchaseGoodsHistoryPriceDto;
import com.loukou.lkt.lkt.resp.PurchaseOrderListDto;
import com.loukou.lkt.lkt.resp.RespDto;
import com.loukou.lkt.lkt.service.PoPurchaseOrderService;

@Service
public class PoPurchaseOrderProcessor {

	@Autowired
	private PoPurchaseOrderService poPurchaseOrderService;
	
	/**
	 * 
	 * @param pageNum
	 * @param pageSize
	 * @return 供应商订单数列表
	 */
	public RespDto<List<PurchaseOrderListDto>> getSupplierOrdersInfo(int userId) {
		return poPurchaseOrderService.getSupplierOrdersInfo(userId);
	}
	
	/**
	 * 
	 * @param supplierName
	 * @param pageNum
	 * @param pageSize
	 * @return 根据供应商名称查找信息
	 */
	public RespDto<List<PurchaseOrderListDto>> getSupplierOrdersInfoBySupplierName(
			String supplierName) {
		return poPurchaseOrderService.getSupplierOrdersInfoBySupplierName(supplierName);
	}
	
	/**
	 * 
	 * @param supplierCode
	 * @param pageNum
	 * @param pageSize
	 * @return 根据供应商编码查找信息
	 */
	public RespDto<List<PurchaseOrderListDto>> getSupplierOrdersInfoBySupplierCode(
			String supplierCode){
		return poPurchaseOrderService.getSupplierOrdersInfoBySupplierCode(supplierCode);
	}
	
	/**
	 * 
	 * @param taosku
	 * @param bn
	 * @param goodsName
	 * @param pageNum
	 * @param pageSize
	 * @return 价格查询
	 */
	public RespDto<PageModel<PurchaseGoodsHistoryPriceDto>> getGoodsHistoryPurchasePrice(
			String taosku, String bn, String goodsName, int pageNum, int pageSize) {
		return poPurchaseOrderService.getGoodsPurchaseHistoryByTaosku(
				taosku, bn, goodsName, pageNum, pageSize);
	}
	
	/**
	 * 
	 * @param orderCode
	 * @return 采购订单详情
	 */
	public PoPurchaseOrderDetailRespDto getPurchaseOrderDetail(String orderCode) {
		return poPurchaseOrderService.getPurchaseOrderDetail(orderCode);
	}
	
	/**
	 * 
	 * @param reqDto
	 * @return 采购订单编辑
	 */
	public RespDto<String> editPurchaseOrder(PoPurchaseOrderDetailReqDto reqDto) {
		return poPurchaseOrderService.editPurchaseOrder(reqDto);
	}
	
	/**
	 * 采购，获取供应商商品.采购申请，商品选择init
	 * @return
	 */
	public PoPurchaseOrderDetailRespDto getSupplierGoodsInfo(int supplierId, int warehouseId) {
		return poPurchaseOrderService.getSupplierGoodsInfo(supplierId, warehouseId);
	}
	
	 /**
	 * @param reqDto
	 * @return 提交采购订单
	 */
	public RespDto<String> submitPurchaseOrder(PurchaseOrderReqDto reqDto) {
		return poPurchaseOrderService.submitPurchaseOrder(reqDto);
	}
	
	/**
	 * 
	 * @param taosku
	 * @param supplierId
	 * @param warehouseId
	 * @return 选择供应商商品后添加商品到采购单
	 */
	public List<PoPurchaseOrderGoodsDto> addGoodsToPurchaseOrder(
			List<String> taosku, int supplierId, int warehouseId) {
		return poPurchaseOrderService.addGoodsToPurchaseOrder(taosku, supplierId, warehouseId);
	}
	
}
